//
//  DiseaseProductTableViewCell.m
//  MyYiJianKangApp
//
//  Created by 张国文 on 16/5/3.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "DiseaseProductTableViewCell.h"

@implementation DiseaseProductTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addMySubview];
    }
    return self;
}

// 布局
- (void)addMySubview
{
    self.diseaseProductImageV = [[UIImageView alloc] initWithFrame:CGRectMake(15 * kAdjustParamater,  15 * kAdjustParamater, 77 * kAdjustParamater, 77 * kAdjustParamater)];
    self.diseaseProductImageV.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.diseaseProductImageV.layer.cornerRadius = self.diseaseProductImageV.width / 2;
    self.diseaseProductImageV.layer.masksToBounds = YES;
    [self.contentView addSubview:_diseaseProductImageV];
    
    self.diseaseProductNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.diseaseProductImageV.right + 6 * kAdjustParamater, self.diseaseProductImageV.top + 10 * kAdjustParamater, 200 * kAdjustParamater, 15 * kAdjustParamater)];
 //   self.diseaseProductNameLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.diseaseProductNameLabel.textColor = [UIColor blackColor];
    self.diseaseProductNameLabel.textAlignment = NSTextAlignmentLeft;
    self.diseaseProductNameLabel.font = [UIFont systemFontOfSize:k16Big];
    [self.contentView addSubview:_diseaseProductNameLabel];
    
    self.diseaseProductIntroduceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.diseaseProductNameLabel.left, self.diseaseProductNameLabel.bottom + 5 * kAdjustParamater, 256 * kAdjustParamater, 35 * kAdjustParamater)];
    //  self.diseaseIntroduceLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.diseaseProductIntroduceLabel.textColor = [UIColor blackColor];
    self.diseaseProductIntroduceLabel.numberOfLines = 0;
    self.diseaseProductIntroduceLabel.font = [UIFont systemFontOfSize:k13Big];
    [self.contentView addSubview:_diseaseProductIntroduceLabel];
    
    
}

- (void)setModel:(SearchProductPackageModel *)model
{
    [self.diseaseProductImageV sd_setImageWithURL:[NSURL URLWithString:model.icon_url] placeholderImage:[UIImage imageNamed:@""]];
    
    self.diseaseProductNameLabel.text = model.name;
    
    self.diseaseProductIntroduceLabel.text = model.short_description;
    // 设置行间距
    [self.diseaseProductIntroduceLabel setAttributedText:[[NetStatusHandle shareHandle] setHangJianJvOfLabel:self.diseaseProductIntroduceLabel.text lineHeight:3]];
    self.diseaseProductIntroduceLabel.lineBreakMode = NSLineBreakByTruncatingTail;
}

@end
